home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
DEMONSTR
/
MATHVIEW.ZIP
/
TRACE.M
< prev
next >
Wrap
Text File
|
1993-03-23
|
348b
|
20 lines
function y = trace(X)
%y=trace(X)
%trace Compute the trace of matrix X
% S.Halevy 7/31/92
% Copyright (c) 1992 by the MathWizards
if nargin < 1
error('not enough arguments')
end
if nargin > 1
error('too many arguments')
end
if isvector(X)
error('trace - argument must be a matrix')
end
y = sum(diag(X));